<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<h1>Region</h1>

<div>
	<h1><c:out value="${region.name}" escapeXml="true" /><br/></h1>		
</div>

<div id="hotelResults">
<c:if test="${not empty hotelList}">
	<table class="summary">
		<thead>
			<tr>
				<th>Name</th>
				<th>Address</th>
				<th>City, State</th>
				<th>Zip</th>
				<th>Action</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="hotel" items="${hotelList}">
				<tr>
					<td>${hotel.name}</td>
					<td>${hotel.address}</td>
					<td>${hotel.city}, ${hotel.state}, ${hotel.country}</td>
					<td>${hotel.zip}</td>
					<td><a href="hotels/${hotel.id}">View Hotel</a></td>
				</tr>
			</c:forEach>
			<c:if test="${empty hotelList}">
				<tr>
					<td colspan="5">No hotels found</td>
				</tr>
			</c:if>
		</tbody>
	</table>
</c:if>
</div>	

<div id="blogs">
	<c:if test="${!empty blogList}">
	<h2>Current Blogs</h2>
	<table class="summary">
		<thead>
			<tr>
				<th>Title</th>
				<th>Catalog</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="blog" items="${blogList}">
			<tr>
				<td>
					<a href="<c:url value="/users/${blog.userId}/blogs/${blog.id}" />"><c:out value="${blog.title}" escapeXml="true" /></a>
				</td>
				<td><c:out value="${blog.catalog.name}" escapeXml="true" /><br/></td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	</c:if>
</div>


<div id="questions">
	<table class="summary">
		<thead>
			<tr>
				<th>Title</th>
				<th>UserId</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="question" items="${questionList}">
			<tr>
				<td>
					<a href="<c:url value="/questions/${question.id}" />"><c:out value="${question.title}" escapeXml="true" /></a>
				</td>
				<td>${question.userId}</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
</div>
